/*
 * Copyright (C) 2009-2011 Knowings
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 3
 * as published by the Free Software Foundation.
 *

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package com.knowings.tbs.trace;

import java.util.Arrays;

import com.knowings.tbs.TBSKernelException;
import com.knowings.tbs.persistence.IPersistent;

/**
 * Exception thrown when an operation is requested on several traces described in different temporal domains.
 * 
 * @author privarola
 */
public class BrokenRelationsException extends TBSKernelException {
  private static final long serialVersionUID = 55025507854922851L;
  private String[] uids;

  private void setUids(String[] uids) {
    this.uids = uids;
  }

  /** Method retrieving the uids that lead to this exception throw.
   * @return an array of {@link String} objects representing the uids of the faulty {@link IPersistent}.
   */
  public String[] getUids() {
    return uids != null ? Arrays.copyOf(uids, uids.length) : null;
  }

  /**
   * @see TBSKernelException#TBSKernelException()
   */
  public BrokenRelationsException() {
    super();
  }

  /**
   * @param uids an array of {@link String} objects representing the uids of the faulty {@link IPersistent}.
   * @param message a {@link String} object.
   * @param cause a {@link Throwable} object.
   * @see TBSKernelException#TBSKernelException(String, Throwable)
   */
  public BrokenRelationsException(String[] uids, String message, Throwable cause) {
    super(message, cause);
    setUids(uids);
  }

  /**
   * @see TBSKernelException#TBSKernelException(String)
   */
  public BrokenRelationsException(String message) {
    super(message);
  }

  /**
   * @param uids an array of {@link String} objects representing the uids of the faulty {@link IPersistent}.
   */
  public BrokenRelationsException(String[] uids) {
    setUids(uids);
  }
}